package com.mjw.zstu.controller;

import com.mjw.zstu.resultDto.JsonResult;
import com.mjw.zstu.service.VisitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("visitor")
public class VisitorController {
    @Autowired
    VisitorService visitorService;

    @RequestMapping("add")
    public JsonResult add(@RequestParam int exhibition_id, int user_id){
        System.out.println(exhibition_id);
        return visitorService.add(user_id,exhibition_id);
    }
    @RequestMapping("list")
    public JsonResult list(int user_id){
        return visitorService.getUserList(user_id);
    }
    @RequestMapping("delete")
    public JsonResult deletevisitor(int id){
        return visitorService.delete(id);
    }
    @RequestMapping("detail")
    public JsonResult detail(int visitor_id){
        return visitorService.detail(visitor_id);
    }
}
